package com.shu.logsearch;

import com.shu.logsearch.common.Constant.StatusConstant;
import com.shu.logsearch.common.sys.model.SysRole;
import com.shu.logsearch.common.sys.model.SysUser;
import com.shu.logsearch.common.sys.service.SysRoleService;
import com.shu.logsearch.common.sys.service.SysUserService;
import com.shu.logsearch.jsch.model.RemoteServerConfig;
import com.shu.logsearch.jsch.service.RemoteServerConfigService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class LogsearchApplicationTests2 {

    @Autowired
    SysUserService sysUserService;
    @Autowired
    SysRoleService sysRoleService;

    @Autowired
    RemoteServerConfigService remoteServerConfigService;

    @Test
    public void addUser() {
        for (int i = 21; i < 30; i++) {
            SysUser sysUser = new SysUser();
            sysUser.setId("id" + i);
            sysUser.setAccount("123");
            sysUser.setStatus(StatusConstant.STATUS_ENABLE);
            sysUserService.save(sysUser);
        }
    }

    @Test
    public void addRole() {
        for (int i = 21; i < 30; i++) {
            SysRole sysRole = new SysRole();
            sysRole.setId("id" + i);
            sysRole.setRoleCode("ADMIN");
            sysRole.setRoleCode("管理员");
            sysRole.setStatus(StatusConstant.STATUS_ENABLE);
            sysRoleService.save(sysRole);
        }
    }

    @Test
    public void addServer() {
        for (int i = 0; i < 20; i++) {
            RemoteServerConfig remoteServerConfig = new RemoteServerConfig();
            remoteServerConfig.setId(i+"");
            remoteServerConfigService.save(remoteServerConfig);
        }
    }



}
